// import { includes } from 'core-js/fn/array'
import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
import Login from '../views/login/login.vue'
import Layout from '../views/layout/layout.vue'
// import store from '../store/index'
// console.log(store)
Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/',
    name: 'layout',
    component: Layout,
    // component: () => import(/* webpackChunkName: "about" */ '../views/layout/layout.vue'),
    children: [
      {
        path: '/',
        name: 'home',
        component: () => import(/* webpackChunkName: "about" */ '../views/home/home.vue')
      },
      {
        path: 'wenda',
        name: 'wenda',
        component: () => import(/* webpackChunkName: "about" */ '../views/wenda/wenda.vue')
      },
      {
        path: 'shipin',
        name: 'shipin',
        component: () => import(/* webpackChunkName: "about" */ '../views/shipin/shipin.vue')
      },
      {
        path: 'setting',
        name: 'setting',
        component: () => import(/* webpackChunkName: "about" */ '../views/setting/setting.vue')
      },
      {
        path: '/search',
        name: 'search',
        // component: search
        // route level code-splitting
        // this generates a separate chunk (search.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "search" */ '../views/search/search.vue')
      },
      {
        path: '/searchResult',
        name: 'result',
        // component: search
        // route level code-splitting
        // this generates a separate chunk (search.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "search" */ '../views/search/result.vue')
      }
    ]
  },
  {
    path: '/article/:id', // 动态路由
    name: 'article',
    // component: search
    // route level code-splitting
    // this generates a separate chunk (search.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "search" */ '../views/article/article.vue')
  },
  {
    path: '/setting/profile',
    name: 'settingProfile',
    component: () => import('../views/setting/profile.vue')
  },
  {
    path: '/setting/chat',
    name: 'chat',
    component: () => import('../views/setting/chat.vue')
  }

  // {
  //   // path: '/about',
  //   // name: 'About'
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   // component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  routes
})

export default router
